#include<bits/stdc++.h>
using namespace std;
long long n;
long long r[100005];
long long jisha=0;
long long flag[100005];
long long qianzhuihe[100005];
long long read(){
    int f=1;
    char c=getchar();
    while(!isdigit(c)){
        if(c=='-')f=-1;
        c=getchar();
    }
    long long x=0;
    while(isdigit(c)){
        x=x*10+c-'0';
        c=getchar();
    }
    return x*f;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    for(long long i=1;i<=n;i++){
        r[i]=read();
        flag[r[i]]++;
    }
    sort(r+1,r+1+n);
    for(long long i=r[1];i<=r[n];i++) qianzhuihe[i]=qianzhuihe[i-1]+flag[i-1];
    for(long long i=r[1]+1;i<=r[n];i++) jisha+=min(flag[i],qianzhuihe[i]-jisha);
    cout<<n-jisha<<"\n";
    return 0;
}
